home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
ptimer13.zip
/
PTIMER13.ASM
< prev
next >
Wrap
Assembly Source File
|
1991-02-19
|
46KB
|
1,061 lines
;
TITLE PTIMER.ASM
;
COMMENT *
Purpose: Times and logs external file-transfer protocols.
Created: 15-APR-1989 V1.00 Richard B. Johnson
Modified: 20-APR-1989 V1.01 Richard B. Johnson
Because of numerous complaints that the timing accuracy was
not sufficient (it could be off 45 seconds/day). The timer code
was changed to use the MS-DOS clock so that the timing reflects
exactly what MS-DOS says. This should be accurate enough because
this is the time to which the PTIMER time was being compared.
Now it "looks" 100 percent accurate.
Modified: 23-APR-1989 V1.02 Richard B. Johnson
Fixed bug in timing routine (typo) when I subtracted 23 hours
for a day rather than 24. Re-wrote time-code to make the day-
rollover correction more obvious.
Modified: 05-AUG-1989 V1.03 Richard B. Johnson
Revised baud-rate search routine to properly read the WILDCAT!
ACTIVITY.LOG because revisions were made by WC! 2.0.
-------------------------------------------------------------------------------
Users Note: Found this excellent program on Richards BBS and
found it serves as a supurb timer for external protocols with
Telix. Will no doubt work well with other communications
programs. Included in this archive are example batch files
for Telix. Modify them to meet your own needs. Line 979 of Dick's
code may be changed to reflect "your" download directory i.e. Telix,
QModem and so on. The compiled PTIMER13.COM in this archive is set
to record transfer results in C:\TELIX\PROTOCOL.LOG - This is a fine
utility, enjoy it and drop Dick a note!. Best Regards,
John V. 02/18/91
*
IF1
%OUT [PASS1]
ELSE
%OUT [PASS2]
ENDIF
VERS STRUC
DB 'V1.03' ; Set version number here.
VERS ENDS
;
; Structure of the data returned from the DOS "find-first" function
; used to obtain file characteristics.
;
FIL_BUF STRUC
RESV DB 21 DUP (?)
ATTR DB ? ; Attribute
FTIM DW ? ; Time
FDAT DW ? ; Date
SIZL DW ? ; Size-low
SIZH DW ? ; Size-high
PNAME DB 13 DUP (?) ; Packed name
FIL_BUF ENDS
;
; Structure of the BIOS segment.
;
BIOS SEGMENT AT 40H
COM1 DW ? ; Base address of 1st 8250 UART
COM2 DW ? ; Base address of 2nd 8250 UART
COM3 DW ? ; Base address of 3rd 8250 UART
COM4 DW ? ; Base address of 4th 8250 UART
PRN1 DW ? ; Base address of printer ports
PRN2 DW ?
PRN3 DW ?
PRN4 DW ?
ORG 06CH
TICKL DW ? ; Low word of timer-tick
TICKH DW ? ; High word of timer-tick
ORG 0F0H
ICA LABEL BYTE ; Inter-process communication area
RES1 DW ?
RES2 DW ?
RES3 DW ?
CX_SAV DW ? ; Saved hours/minutes
DX_SAV DW ? ; Saved seconds
BIOS ENDS
;
; Misc. equates.
;
CR EQU 0DH
LF EQU 0AH
MS_DOS EQU 21H ; Operating system
FBUF EQU 80H ; Default file-buffer
;
PSEG SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:PSEG, DS:PSEG, ES:PSEG, SS:NOTHING
START EQU $
ORG 100H
MAIN PROC NEAR
MOV SP,OFFSET STACK ; Put in a safe place
;
; Immediately get the system time, extract any old time,
; and save the new value in the ICA.
;
MOV AX,2C00H ; Get the time
INT MS_DOS ; From DOS
MOV WORD PTR [NEW_CX],CX ; Save the new time locally
MOV WORD PTR [NEW_DX],DX ; seconds/hundredths
PUSH DS ; Save the segment
MOV AX,BIOS ; Pick up BIOS segment
MOV DS,AX ; Set segment
ASSUME DS:BIOS ; Tell assembler
MOV AX,WORD PTR [CX_SAV] ; Pick up old time
MOV BX,WORD PTR [DX_SAV] ; seconds/hundredths
MOV WORD PTR [CX_SAV],CX ; Save new values
MOV WORD PTR [DX_SAV],DX ; seconds/hundreds
POP DS ; Restore segment
ASSUME DS:PSEG ; Tell the assembler
MOV WORD PTR [OLD_CX],AX ; Save old time hour/minutes
MOV WORD PTR [OLD_DX],BX ; Save old time seconds/tenths
;
; Map the required command-line to upper case and extract the
; string length.
;
CALL MAP_CMD ; Map the command-line
TEST CX,CX ; Check for anything typed
JNZ CMD_OK ; Was okay
MOV DX,OFFSET USAGE ; Point to usage prompt
CALL PROMPT ; Write to screen
JMP FINIS ; Exit
CMD_OK: PUSH CX ; Save characters typed
CALL WHEN ; Get data/time
POP CX ; Restore characters typed
CALL CHK_CMD ; Check commands, extract parameters
MOV DI,WORD PTR [STR_ADDR] ; Get addr. of string we are building
MOV SI,OFFSET PRP5 ; The baud-rate
CALL COPY
MOV AX,WORD PTR [RATE] ; Pick up the rate
XOR DX,DX ; Zero high word
CALL ASCII ; Convert to ASCII
;
; Calculate the time in seconds from the values contained in:
; OLD_CX = [hour] [minutes] of the starting time.
; OLD_DX = [seconds] [hundredths] of the starting time.
; NEW_CX = [hour] [minutes] of the ending time.
; NEW_DX = [seconds] [hundredths] of the ending time
;
; To do this accurately, we will convert the ending time of
; hh:mm:ss to seconds. Then we will convert the starting time of
; hh:mm:ss to seconds. We will then subtract the two. If midnight
; has occurred, we will adjust accordingly.
;
MOV AX,WORD PTR [NEW_DX] ; AH = secs, AL = tenths
MOV AL,AH ; Get seconds
XOR AH,AH ; Remove tenths
MOV WORD PTR [SEC_LO],AX ; Save the new seconds
MOV WORD PTR [SEC_HI],0 ; Zero the high word
MOV AX,WORD PTR [NEW_CX] ; Get new hours/minutes
MOV BX,AX ; Save
XOR AH,AH ; Remove hours, keep minutes
MOV CX,60 ; Seconds/minute
MUL CX ; AX = minutes * 60
ADD WORD PTR [SEC_LO],AX ; Add to accumulator
ADC WORD PTR [SEC_HI],0 ; Take care of overflow
MOV CX,WORD PTR [OLD_CX] ; Get old hours/minutes
CMP BH,CH ; BH = new CH = old
JNC DAY_OK ; Not a new day
ADD BH,24 ; compensate for new day
;
DAY_OK: MOV AL,BH ; Get hours
XOR AH,AH ; Remove high byte
MOV CX,3600 ; Seconds/hour
MUL CX ; DX:AX = seconds
ADD WORD PTR [SEC_LO],AX ; Add to the accumulator
ADC WORD PTR [SEC_HI],DX ; Add the high word
;
MOV AX,WORD PTR [OLD_DX] ; AH = secs, AL = tenths
MOV AL,AH ; Get seconds
XOR AH